<?php

/**
 *
 */
class news extends CI_Controller {

  public function __construct(){
      parent::__construct();
      $this->load->helper('url_helper');
      $this->load->library('session');
      $this->load->model('M_news');
      $this->load->library('pagination');
  }
  public function news_list(){
    $page = 0;
    $offset = 0;
    $per_page = 20;
    if(!empty($_GET['per_page'])){
      $page = $_GET['per_page'];
      $offset = ($page-1)*$per_page;
    }
    $result = $this->M_news->getNewsList($per_page,$offset);
    if(!empty($_GET['search'])){
      $result = $this->M_shop->selectShop($_GET['search'],$per_page,$offset);
    }
    $config['base_url']=site_url('news/news_list');
    $config['total_rows'] = $result['total'];
    $config['per_page'] = $per_page;
    $this->pagination->initialize($config);
    $data['shop_list'] = $result['newslist'];
    $data['pager'] = $this->pagination->create_links();
    $this->load->view('news_list');
  }
  /**
  *
  *
  */
  public function news_add(){
    $this->load->view('news_add');
  }
  public function news_add_go(){
  }
  public function news_update(){
  }
  public function news_delete(){
    $this->load->view('news_list');
  }
}


 ?>
